// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "imageInfo.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "HightScreenshotLib.generated.h"

class UTexture2D;
/**
 * 
 */
UCLASS()
class ST_SCREENSHOT_API UHightScreenshotLib : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
public:

	UFUNCTION(BlueprintCallable)
		static bool SimpleScreenshot(
			AActor* targetActo, FVector point, FRotator rotator
			, int sizeX, int sizeY, TArray<FColor>& outColor
			, float fov = 90.0f, int inFrameDelay = 32
			, EScreenshotShowFlags flags = EScreenshotShowFlags::Lit);

	UFUNCTION(BlueprintCallable)
		static bool CompressTexture(int sizeX, int sizeY
			, const TArray<FColor>& Colors, EOutImageFormat format
			, TArray<uint8>& outData, int q = 80);

	UFUNCTION(BlueprintCallable)
		static bool MirroTexture(int sizeX, int sizeY,const TArray<FColor>& inColors,TArray<FColor>& OutColors
			, bool mirrorX = false, bool mirrorY = false);

	UFUNCTION(BlueprintCallable)
		static UTexture2D* CreateTexture2DFromImage(int sizeX, int sizeY
			, const TArray<FColor>& ColorArray, EColorGammaSpace gammaSpace = EColorGammaSpace::sRGB);
		UFUNCTION(BlueprintCallable)
		static UTexture2D* CreateTexture2DFromImageL(int sizeX, int sizeY
			, const TArray<FLinearColor>& ColorArray);
	UFUNCTION(BlueprintCallable)
		static bool SaveToDisk(FString path, const TArray<uint8>& data);

	UFUNCTION(BlueprintCallable)
		static bool Screenshot(FScreenshotInfo info, TArray<FColor>& outColor);

	UFUNCTION(BlueprintCallable,meta = (WorldContext = "WorldContextObject"))
	static void GetFirstPostProcessSettings(UObject* WorldContextObject
		, FPostProcessSettings& outPostProcessSettings, float& PostProcessBlendWeight);



};